/**
 * Created by lan on 17/2/10.
 */
let webpack = require("webpack");
//生成HTML
let html = require("html-webpack-plugin");
//删除文件
let clean = require('clean-webpack-plugin');

module.exports = {
    entry:"./app/app.js",
    output:{
        path:__dirname+"/www",
        filename:"bundle.js"
    },
    module:{
        loaders:[
            {
                test:/\.css$/,
                loader:"style-loader!css-loader!less-loader"
            },
            {
                test:/\.(png|jpe?g|gif)$/,
                loader:"url-loader?limit=5120&name=images/[name]-[hash:5].[ext]"
            },
            {
                test:/\.vue$/,
                loader:"vue-loader"
            }
        ]
    },
    plugins:[
        new html({
            title:"生活",
            template:__dirname+"/app/index.html",
            filename:"index.html",
        }),
        new clean(["www/js"])
    ],
    resolve:{
        alias:{
            'vue$': 'vue/dist/vue.common.js'
        }
    },
    devServer: {//自动刷新
        contentBase:"./www",
        inline: true,
        port: 8088
        //运行  webpack-dev-server
    },
};